import { request } from '@/service/request';
import { removeEmptyProps } from '@/utils/common';
import type { Log } from '../../types/log';

export function statsOperLogs(params?: any) {
  return request<Log.OperLogstatsVO>({
    url: '/monitor/operlog/logs/stats',
    method: 'get',
    params
  });
}
export function countOperLogStatus() {
  return request<Log.statsCountVO>({
    url: '/monitor/operlog/logs/count',
    method: 'get'
  });
}
export function getPageList(params?: any) {
  const requestParams = removeEmptyProps(params);
  return request<Log.OperLogVO>({
    url: '/monitor/operlog/list',
    method: 'get',
    params: requestParams
  });
}

export function getErrorStack(id: number) {
  return request({
    url: `/monitor/operlog/stack/${id}`,
    method: 'get'
  });
}
/** 清空操作日志 */
export function clean(type: string | number) {
  return request({
    url: `/monitor/operlog/clean/${type}`,
    method: 'DELETE'
  });
}
